// 无序的,不重复的 (js 有内置的 Set)

function MySet() {
  this.items = {};

  MySet.prototype.add = function (val) {
    if (this.has(val)) return false;
    this[val] = val;
  };
  MySet.prototype.has = function (val) {
    return this.items.hasOwnProperty(val);
  };
  MySet.prototype.remove = function (val) {
    if (!this.has(val)) return false;
    delete this.items[val];
    return true;
  };

  MySet.prototype.clear = function () {
    this.items = {};
  };
  MySet.prototype.size = function () {
    return Object.keys(this.items).length;
  };
  MySet.prototype.values = function () {
    return Object.keys(this.items);
  };
}
